package com.loyal.loyalerp.humenresource.kaoqinMonth.util;

import java.io.IOException;

import org.springframework.beans.factory.annotation.Autowired;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.loyal.loyalerp.mapper.GyUserMapper;

public class UserIdSerialize extends JsonSerializer<Integer>{

	@Autowired
	GyUserMapper userMapper;
	
	@Override
	public void serialize(Integer value, JsonGenerator jg, SerializerProvider provider)
			throws IOException, JsonProcessingException {
		
		jg.writeString(userMapper.selectByPrimaryKey(value).getUsername());
	}

}
